]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
notificationDaemon: Use static values for the serialized name and format
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Thu, 10 Sep 2026 16:45:22 +0000 (18:45 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 13 Sep 2026 18:18:08 +0000 (20:18 +0200)
Avoid repeating these multiple times

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4400>
(cherry picked from commit 01ec33e864c2e9b29c79f7293e3b8a59a71b4350)

js/ui/notificationDaemon.js

index e94a9e81de1be74a8ef3aa2ebcec7882e2d236f3..9ea539c56a620e20d692afcaf1fb28167388c51c 100644 (file)
@@ -14,6 +14,9 @@ import {NotificationErrors, NotificationError} from '../misc/dbusErrors.js';
 
 const FdoNotificationsIface = loadInterfaceXML('org.freedesktop.Notifications');
 
+const NOTIFICATION_SERIALIZED_NAME = 'notifications';
+const NOTIFICATION_SERIALIZED_FORMAT = 'a(sa(sv))';
+
 /** @enum {number} */
 const NotificationClosedReason = {
     EXPIRED: 1,
@@ -615,7 +618,10 @@ class GtkNotificationDaemon {
         this._isLoading = true;
 
         try {
-            const value = global.get_persistent_state('a(sa(sv))', 'notifications');
+            const value = global.get_persistent_state(
+                NOTIFICATION_SERIALIZED_FORMAT,
+                NOTIFICATION_SERIALIZED_NAME);
+
             if (value) {
                 const sources = value.deepUnpack();
                 sources.forEach(([appId, notifications]) => {
@@ -658,7 +664,8 @@ class GtkNotificationDaemon {
             sources.push(source.serialize());
         }
 
-        global.set_persistent_state('notifications', new GLib.Variant('a(sa(sv))', sources));
+        global.set_persistent_state(NOTIFICATION_SERIALIZED_NAME,
+            new GLib.Variant(NOTIFICATION_SERIALIZED_FORMAT, sources));
     }
 
     AddNotificationAsync(params, invocation) {